package com.lzc.tlmail.tlmailproduct.web;

import com.lzc.tlmail.tlmailproduct.service.SkuInfoService;
import com.lzc.tlmail.tlmailproduct.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.io.PipedReader;

/**
 * @author lzc
 * @create 2020-10-09 14:38
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * 查看商品详情
     * @param skuId
     * @param model
     * @return
     */
    @GetMapping("/{skuId}.html")
    public String skuInfo(@PathVariable("skuId")Long skuId, Model model){
       SkuItemVo skuItemVo=skuInfoService.item(skuId);
        model.addAttribute("skuItem",skuItemVo);
        return "item";
    }
}
